﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EARS.App_Code;

namespace EARS
{
    public partial class ForgetPassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Protected/Home.aspx");
        }

        protected void btnSend_Click(object sender, EventArgs e)
        {
            Account a = new Account();
            bool check = a.ForgetPassword(txtUserID.Text, txtEmail.Text);
            if (check == true)
            {
                lblPopUp.Text = "E-Mail has been successfully sent!";
                mpe.Show();
            }
            else
            {
                lblPopUp.Text = "Error: The E-Mail you have entered does not match the E-Mail registered for the account. Please try again.";
                mpe.Show();
            }
        }

        protected void btnClose_Click(object sender, EventArgs e)
        {
            if (lblPopUp.Text.Equals("E-Mail has been successfully sent!"))
            {
                mpe.Hide();
                Response.Redirect("~/Home.aspx");
            }
            else
            {
                mpe.Hide();
            }
        }
    }
}